#include "Star.h"

IMAGE* Star::imgStars[4] = { NULL };

// 构造函数
Star::Star()
{
	// 加载图片
	if (imgStars[0] == NULL)
	{
		IMAGE imgTmp;
		loadimage(&imgTmp, "./resources/image/star.png", size * 4, size);
		SetWorkingImage(&imgTmp);				// 设定当前绘图目标为imgTmp
		for (int i = 0; i < 4; i++)
		{
			imgStars[i] = new IMAGE;
			getimage(imgStars[i], i * size, 0, size, size);
		}
		SetWorkingImage();						// 设置绘图目标为绘图窗口
	}

	// 计时开始
	this->lastTime = GetTickCount64();
}

// 绘制星星
void Star::draw()
{
	myDrawImage(column * BLOCK_SIZE, row * BLOCK_SIZE, imgStars[frameIndex]);
}